
/**
 * copyright(c) 2013 www.jiongshibaoliao.com, All Rights Reserved.
 * project: jiongshibaoliao 
 * author: 曾帅
 * date: 2014-1-10 下午03:41:33
 * version: v1.0
 */

package com.jiongshibaoliao.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.jiongshibaoliao.common.mybatis.Page;
import com.jiongshibaoliao.common.mybatis.PageBean;
import com.jiongshibaoliao.dao.CommentDao;
import com.jiongshibaoliao.exception.JiongException;
import com.jiongshibaoliao.mapper.BaseMapper;
import com.jiongshibaoliao.mapper.CommentMapper;
import com.jiongshibaoliao.model.Comment;

/**
 * @project jiongshibaoliao
 * @author 曾帅 
 * @version 1.0
 * @date 2014-1-10 下午03:41:33   
 */

@Repository
public class CommentDaoImpl extends BaseDaoImpl implements CommentDao {

	@Autowired
	public CommentMapper commentMapper;
	
	/**
	 * 
	 * @author 曾帅
	 * @version 1.0
	 * @date 2014-1-10 下午03:41:53
	 * @see com.jiongshibaoliao.dao.CommentDao#getCommentPageList(com.jiongshibaoliao.common.mybatis.PageBean, com.jiongshibaoliao.model.Comment)
	 */
	@Override
	public Page getCommentPageList(PageBean pageBean, Comment comment) {
		List<Comment> commentlist = (List<Comment>) commentMapper.getCommentPageList(pageBean, comment);
		return new Page(commentlist, pageBean);
	}

	
	/**
	 * 
	 * @author 曾帅
	 * @version 1.0
	 * @throws JiongException 
	 * @date 2014-1-10 下午03:41:53
	 * @see com.jiongshibaoliao.dao.BaseDao#delete(long)
	 */
	@Override
	public void delete(long id) throws JiongException {
		throw new JiongException("无权执行此操作！");
	}

	
	/**
	 * 
	 * @author 曾帅
	 * @version 1.0
	 * @date 2014-1-10 下午09:36:47
	 * @see com.jiongshibaoliao.dao.impl.BaseDaoImpl#getMapper()
	 */
	@Override
	public BaseMapper getMapper() {
		return commentMapper;
	}


	
	/**
	 * 
	 * @author 曾帅
	 * @version 1.0
	 * @date 2014-2-12 下午04:44:09
	 * @see com.jiongshibaoliao.dao.CommentDao#getCommentCountByArticleId(long)
	 */
	@Override
	public long getCommentCountByArticleId(long articleId) {
		return commentMapper.getCommentCountByArticleId(articleId);
	}

}
